function FMPServ(errObj) { this.reporterr = function() { var eo = window.errObj; if ( eo != null ) { var err = eo.code; if ( err != null ) { var errors = new this.buildErrs(); var output = null; var erref = "e" + err; var re = eo.reason; if ( errors[erref] != null && errors[erref][re] != null ) output = errors[erref][re]; else output = errors.def; if ( output != null ) alert( output ); if( errors.http == false ) { switch( err ) { case 112: case 802: case 812: top.location = eo.path + "-home"; break; default: window.location = eo.path + "-open"; break; } } else { switch( err ) { case 400: if( eo.reason == 12 ) { top.location = eo.path + "-home"; break; } case 403: if( eo.reason == 1 ) { this.writeToBody( output ); break; } case 404: this.writeToBody( output ); break; default: window.location = eo.path + "-open"; break; } } } } } this.writeToBody = function( out ) { if ( out != null ) { var lines = out.split("\r"); var body = document.body; for( var i in lines ) { var h1 = document.createElement("h1") var txt = document.createTextNode(lines[i]); h1.appendChild(txt); body.appendChild(h1); } } } this.buildErrs = function() { this.paramtext = function(dest,c1,c2) { var output = ""; if ( dest != null ) { output += this.replaceparm(dest,c1,1); output += this.replaceparm(dest,c2,2); } return output; } this.replaceparm = function(dest,src,i) { var index = dest.indexOf("^" + i); if ( index > -1 ) { if ( src == null ) src = ""; return ( dest.substring(0, index) + src + dest.substring(index + 2, dest.length) ); } else return ""; } var eo = window.errObj; var errs = window.errs; if ( eo != null && errs != null ) { this.def = this.paramtext ( errs.e_default, eo.code ); if( errs.http ) { this.http = true; this.e200 = [ errs.e_200_0 ]; this.e204 = [ this.paramtext ( errs.e_204_0, eo.cause ) ]; this.e400 = [ errs.e_400_0, this.paramtext ( errs.e_400_1, eo.cause ), this.paramtext ( errs.e_400_2, eo.cause ), this.paramtext ( errs.e_400_3, eo.cause ), this.paramtext ( errs.e_400_4, eo.cause ), this.paramtext ( errs.e_400_5, eo.cause ), errs.e_400_6, errs.e_400_7, errs.e_400_8, this.paramtext ( errs.e_400_9, eo.cause ), this.paramtext ( errs.e_400_10, eo.cause ), this.paramtext ( errs.e_400_11, eo.cause ), errs.e_400_12 ]; this.e403 = [ errs.e_403_0, errs.e_403_1 ]; this.e404 = [ this.paramtext ( errs.e_404_0, eo.cause ) ]; this.e417 = [ this.paramtext ( errs.e_417_0, eo.cause ) ]; this.e500 = [ errs.e_500_0, this.paramtext ( errs.e_500_1, eo.cause ), this.paramtext ( errs.e_500_2, eo.cause ) ]; this.e501 = [ errs.e_501_0 ]; this.e505 = [ errs.e_505_0 ]; } else { this.http = false; this.e100 = [ this.paramtext( errs.e_100_0, eo.cause ) ]; this.e101 = [ errs.e_101_0 ]; this.e102 = [ errs.e_102_0 ]; this.e105 = [ this.paramtext( errs.e_105_0, eo.cause ) ]; this.e200 = [ this.paramtext( errs.e_200_0, eo.cause ) ]; this.e301 = [ this.paramtext( errs.e_301_0, ( eo.cause == "delete" ) ? errs.e_301_1 : errs.e_301_2 ) ]; this.e301[1] = this.e301[0]; this.e400 = [ errs.e_400_0 ]; this.e401 = [ this.paramtext ( errs.e_401_0, eo.cause ) ]; this.e509 = [ this.paramtext( errs.e_509_0, eo.cause ) ]; var entry = [ errs.entry_0, errs.entry_1 ]; var tmp = this.paramtext( errs.e_500_0, eo.cause ); this.e500 = [ entry[0] + tmp, entry[1] + tmp ]; tmp = this.paramtext( errs.e_501_0, eo.cause ); this.e501 = [ entry[0] + tmp, entry[1] + tmp ]; tmp = this.paramtext( errs.e_502_0, eo.cause ); this.e502 = [ entry[0] + tmp, entry[1] + tmp ]; tmp = this.paramtext( errs.e_503_0, eo.cause ); this.e503 = [ entry[0] + tmp, entry[1] + tmp ]; tmp = this.paramtext( errs.e_504_0, eo.cause ); this.e504 = [ entry[0] + tmp, entry[1] + tmp ]; tmp = this.paramtext( errs.e_505_0, eo.cause ); this.e505 = [ entry[0] + tmp, entry[1] + tmp ]; tmp = this.paramtext( errs.e_506_0, eo.cause ); this.e506 = [ entry[0] + tmp, entry[1] + tmp ]; tmp = this.paramtext( errs.e_507_0, eo.cause ); this.e507 = [ entry[0] + tmp, entry[1] + tmp ]; this.e510 = [ entry[0] + errs.e_510_0, entry[1] + errs.e_510_0 ]; this.e812 = [ errs.e_802_0 ]; this.e803 = [ this.paramtext( errs.e_803_0, eo.cause ) ]; } } } } function setup() { if ( window.fmpserver != null ) fmpserver.reporterr(); } if ( window.fmpserver == null ) { var eo = window.errObj; if ( eo != null ) window.fmpserver = new FMPServ(eo); } //-->